<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :data="data.rtnList"
      :total="total"
      :max-height="gridMaxHeight"
      :all-define-columns="['sysOrgName','busOtherCpyName','busDate','totalMoney','processMoney','processStatus','taxRate','priceCur','invoiceType','paymentType','paymentPeriodDay','busUserName','sourceCode','sourceDetailLotNo','lastUpdateDate']"
      grid-id="finWaitMngProcessGridId"
      @selection-change="handleGridSelectionChange">
      <DataGridColumn slot="sysOrgName" prop="sysOrgName" label="下单机构" />
      <DataGridColumn slot="busOtherCpyName" prop="busOtherCpyName" label="供应商"/>
      <DataGridColumnSlot slot="busDate" prop="busDate" label="业务时间">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.busDate) }}</span>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="sourceCode" prop="sourceCode" label="来源单号" />
      <DataGridColumn slot="totalMoney" prop="totalMoney" label="应付金额" />
      <DataGridColumn slot="processMoney" prop="processMoney" label="已付金额" />
      <DataGridColumnSlot slot="processStatus" prop="processStatus" label="付款状态">
        <template slot-scope="scope">
          <template v-for="item in dicts.fin_process_status">
            <el-tag v-if="scope.row.processStatus === item.dictCode" :key="item.id" :type="item.attribute1" >{{ item.dictName }}</el-tag>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="taxRate" prop="taxRate" label="税率" />
      <DataGridColumnSlot slot="priceCur" prop="priceCur" label="本位币">
        <template slot-scope="scope">
          <template v-for="item in dicts.bus_price_cur">
            <span v-if="scope.row.priceCur === item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumnSlot slot="invoiceType" prop="invoiceType" label="发票类型">
        <template slot-scope="scope">
          <template v-for="item in dicts.bus_invoice_type">
            <span v-if="scope.row.invoiceType === item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumnSlot slot="paymentType" prop="paymentType" label="结算方式">
        <template slot-scope="scope">
          <template v-for="item in dicts.bus_payment_type">
            <span v-if="scope.row.paymentType === item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="paymentPeriodDay" prop="paymentPeriodDay" label="付款周期天数" />
      <DataGridColumn slot="busUserName" prop="busUserName" label="采购员" />
      <DataGridColumn slot="sourceDetailLotNo" prop="sourceDetailLotNo" label="来源明细" />
      <DataGridColumnSlot slot="lastUpdateDate" prop="lastUpdateDate" label="最后更新时间" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdateDate) }}</span>
        </template>
      </DataGridColumnSlot>
    </DataGridTable>
  </div>
</template>

<script>
import { parseTime } from '@/utils/index'
import eHeader from './module/poHeader'
import initData from '@/mixins/initData'
import finWait from '@/api/fin/FinWait'

export default {
  components: { eHeader },
  mixins: [initData],
  dictTypes: ['bus_price_cur', 'bus_invoice_type', 'bus_payment_type', 'fin_process_status'],
  props: {
  },
  data() {
    return {
      delLoading: false,
      sup_this: this
    }
  },
  created() {
    this.url = finWait.loadDataUrl()
    this.searchToggle = true
    this.defaultParamBean.busClass = '800003-002'
    this.defaultParamBean.processStatus = 'wait'
    this.$nextTick(() => {
      this.resetQuery(true)
    })
  },
  mounted() {
  },
  methods: {
    parseTime,
    async beforeInit() {
      return true
    }
  }
}
</script>
